package com.Maykk.Demo11;

import java.util.function.Function;

/**
 * @ClassName: FunctionDemo
 * @Description: TODO Function 加工接口
 * @Author: MaykkStar@163.com
 */
public class FunctionDemo {
    public static void main(String[] args) {
        convert("456789", s -> Integer.parseInt(s));
        convert("9876543", Integer::parseInt);
        System.out.println("'''''''''''''''''''''");
        convert(1234, i -> String.valueOf(i));
        convert(1234,String::valueOf);
    }

    public static void convert(String str, Function<String, Integer> fun) {
        Integer integer = fun.apply(str);
        System.out.println(integer);
    }

    public static void convert(Integer i, Function<Integer, String> fun) {
        String str = fun.apply(i);
        System.out.println(str);
    }
}
